package com.tetris;

import java.awt.Color;
import java.awt.Point;
import java.awt.Rectangle;
import java.util.ResourceBundle;

// 常量
class Const {
    // 格
    public static final int GRID_SIZE = 26;                                                     // 尺寸

    // 方块
    public static final int BLOCK_GRID_COUNT_H = 4;                                             // 一个方向由
    public static final int BLOCK_GRID_COUNT_V = 4;                                             // 4*4 的格组成
    
    // 游戏区域
    public static final int GAME_BOARD_X = 20;                                                  // 左上角 X 坐标
    public static final int GAME_BOARD_Y = 20;                                                  // 左上角 Y 坐标
    public static final int GAME_BOARD_GRID_COUNT_H = 10;                                       // 横向格数
    public static final int GAME_BOARD_GRID_COUNT_V = 20;                                       // 纵向格数
    public static final int GAME_BOARD_WIDTH = GRID_SIZE * GAME_BOARD_GRID_COUNT_H;             // 宽度
    public static final int GAME_BOARD_HEIGHT = GRID_SIZE * GAME_BOARD_GRID_COUNT_V;            // 高度
    public static final Color GAME_BOARD_COLOR = Color.WHITE;                                   // 背景色

    // 预览区域
    public static final int PREVIEW_X = GAME_BOARD_X + GAME_BOARD_WIDTH + GRID_SIZE;            // 左上角 X 坐标
    public static final int PREVIEW_Y = GAME_BOARD_Y;                                           // 左上角 Y 坐标
    public static final int PREVIEW_WIDTH = GRID_SIZE * 5;                                      // 宽度
    public static final int PREVIEW_HEIGHT = GRID_SIZE * 5;                                     // 高度
    public static final Color PREVIEW_COLOR = Color.WHITE;                                      // 背景色
    
    // 定时器
    public static final int TIMER_INIT = 1000;                                                  // 初始间隔值，单位毫秒
    public static final int TIMER_GROW = 100;                                                   // 增长间隔值，单位毫秒，难度每增加1级，间隔值减少此数

    // 难度
    public static final int DIFF_BASE = 5000;                                                   // 基数。分数每达到此数的整数倍时，难度增加
    public static final int DIFF_MAX = 10;                                                      // 最大值。难度达到此数后不再增加
    
    // 胜利数
    public static final int WIN_NUMBER = DIFF_BASE * DIFF_MAX;                                  // 达到此数胜利
    
    // 画图片控件的边框(PictureCtrl.drawEdge 方法)用到的颜色
    public static final Color COLOR_LEFT_TOP_1 = new Color(214, 211, 206);                      // 左上外层颜色
    public static final Color COLOR_LEFT_TOP_2 = Color.WHITE;                                   // 左上内层颜色
    public static final Color COLOR_RIGHT_BOTTOM_1 = new Color(66, 65, 66);                     // 右下内层颜色
    public static final Color COLOR_RIGHT_BOTTOM_2 = new Color(132, 130, 132);                  // 右下外层颜色
    
    // 音乐
    public static final String MUSIC_FILE_NAME = "./res/music.wav";                             // 文件路径

    // 主窗口
    public static final int WIDTH = 464;                                                        // 宽度
    public static final int HEIGHT = 614;                                                       // 高度
    public static final String IMAGE_PATH = "./res/main_window.png";                            // 背景图片文件路径

    // 控件
    public static final Rectangle LABEL_HELP_BOUNDS = new Rectangle(306, 172, 130, 106);        // "操作说明"标签位置、尺寸
    public static final Point BUTTON_START_POS = new Point(306, 398);                           // "开始"按钮位置
    public static final Point BUTTON_PAUSE_POS = new Point(306, 448);                           // "暂停"按钮位置
    public static final Point BUTTON_MUSIC_POS = new Point(306, 498);                           // "播放音乐"按钮位置
    public static final String BUTTON_START_IMAGE_PATH = "./res/button_start.png";              // "开始"按钮的图片文件路径
    public static final String BUTTON_PAUSE_IMAGE_PATH = "./res/button_pause.png";              // "暂停"按钮的图片文件路径
    public static final String BUTTON_RESUME_IMAGE_PATH = "./res/button_resume.png";            // "继续"按钮的图片文件路径
    public static final String BUTTON_MUSIC_PLAY_IMAGE_PATH = "./res/button_music_Play.png";    // "播放音乐"按钮的图片文件路径
    public static final String BUTTON_MUSIC_STOP_IMAGE_PATH = "./res/button_music_stop.png";    // "停止音乐"按钮的图片文件路径

    // 其它
    private static final ResourceBundle RESOURCE = ResourceBundle.getBundle("language_zh_CN");  // 字符串资源
    
    /**
     * 获取字符串。
     * @param id   字符串 id
     * @return 字符串
     */
    public static String getString(String id) {
        return RESOURCE.getString(id);
    }
}
